﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace App.DbContexts
{
    public class Config
    {
        static Config()
        {
            var filePath = AppDomain.CurrentDomain.BaseDirectory + "config.json";
            if (!File.Exists(filePath))
                throw new Exception("找不到config.json");
            var file = File.ReadAllText(filePath);
            var obj = JsonConvert.DeserializeObject(file) as JObject;
            AppTestDBConnectionString = obj["ConnectionStrings"]["AppTestDB"].ToString();
            AppTestDB2ConnectionString = obj["ConnectionStrings"]["AppTestDB2"].ToString();

        }

        public static string AppTestDBConnectionString { get; set; }
        public static string AppTestDB2ConnectionString { get; set; }
    }
}
